package errors

import "github.com/pkg/errors"

type cError struct {
	Code    int32
	Reason  string
	Message string
}

func (e *cError) Error() string {
	return e.Message
}

func IsNotFound(err error) bool {
	if err == nil {
		return false
	}
	e := &cError{}
	if !errors.As(err, &e) {
		return false
	}
	return e.Code == 404 && e.Reason == "NOT FOUND"
}

func NotFoundError() error {
	return errors.Wrap(&cError{
		Code:    404,
		Reason:  "NOT FOUND",
		Message: "",
	}, "")
}
